package pres.man.interview.thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 线程一直占用cpu
 *
 * @Author MAN
 * @Date 2021-01-18-14:51
 */
public class ThreadCPU {

    public static void main(String[] args) {
        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(8, 8, 3, TimeUnit.SECONDS, new ArrayBlockingQueue<>(1), new ThreadPoolExecutor.AbortPolicy());
        for (int i = 0; i < 9; i++) {
            poolExecutor.execute(() -> {
                while (true) {
                }
            });
        }
    }
}
